/*
 * @(#)MaintUserRoleAction.java
 *
 * Copyright (c) 2003 DCIVision Ltd
 * All rights reserved.
 *
 * This software is the confidential and proprietary information of DCIVision
 * Ltd ("Confidential Information").  You shall not disclose such Confidential
 * Information and shall use it only in accordance with the terms of the license
 * agreement you entered into with DCIVision Ltd.
 */
package com.dcivision.workflow.web;

import java.sql.Timestamp;

import javax.servlet.http.HttpServletRequest;

import org.apache.struts.action.ActionErrors;
import org.apache.struts.action.ActionMapping;

import com.dcivision.framework.ApplicationException;
import com.dcivision.framework.TextUtility;
import com.dcivision.framework.bean.AbstractBaseObject;
import com.dcivision.framework.web.AbstractActionForm;
import com.dcivision.workflow.bean.WorkflowScheduleTriggers;

/**
MaintWorkflowRecordAction.java

This class is for maint wprkflow record.

  @author          Tony Chen
  @company         DCIVision Limited
  @creation date   23/12/2004
  @version         $Revision: 1.3 $
*/
public class MaintWorkflowScheduleTriggerForm extends AbstractActionForm {

	private Integer workflowRecordID = null;
  private String scheduleName = null;
  private String criteriaExpression = null;
  private String criteriaConfig = null;
  private Timestamp scheduleStart = null;
  private Timestamp scheduleEnd = null;
  private Integer scheduleType = null;
  private Integer scheduleStyle = null;
  private String includeList = null;
  private String extraParameter1 = null;
  private String extraParameter2 = null;
  private Integer recurrRunCnt = null;
  private Integer recurrMaxRun = null;
  private String recurrExpression = null;
  private String status = null;
  
  private String workflowGroupID = null;
	private int triggerHour = -1;
  private int triggerMinute = -1;
  private String dailyStyle = null;
  private String weeklyStyle = null;
  private String monthlyStyle = null;
  private String endStyle = null;
  private String[] daysOfWeek = null;
  private String dayOfMonth = null;
  private String dayOfWeek = null;
  private String weekOfMonth = null;
  private String[] monthsOfYear = null;
  private String startDate = null;
  private String endDate = null;
  private String maxTrigger = null;
	private String intervalDay = null;
  private String intervalWeek = null;
  
  public String getCriteriaConfig() {
		return criteriaConfig;
	}
  
	public void setCriteriaConfig(String criteriaConfig) {
		this.criteriaConfig = criteriaConfig;
	}
    
	public String getCriteriaExpression() {
		return criteriaExpression;
	}
    
	public void setCriteriaExpression(String criteriaExpression) {
		this.criteriaExpression = criteriaExpression;
	}
    
	public String getExtraParameter1() {
		return extraParameter1;
	}
    
	public void setExtraParameter1(String extraParameter1) {
		this.extraParameter1 = extraParameter1;
	}
    
	public String getExtraParameter2() {
		return extraParameter2;
	}
    
	public void setExtraParameter2(String extraParameter2) {
		this.extraParameter2 = extraParameter2;
	}
    
	public String getIncludeList() {
		return includeList;
	}
    
	public void setIncludeList(String includeList) {
		this.includeList = includeList;
	}
    
	public String getRecurrExpression() {
		return recurrExpression;
	}
    
	public void setRecurrExpression(String recurrExpression) {
		this.recurrExpression = recurrExpression;
	}
     
	public String getStatus() {
		return status;
	}
    
	public void setStatus(String status) {
		this.status = status;
	}
    
	public Integer getRecurrMaxRun() {
		return recurrMaxRun;
	}
    
	public void setRecurrMaxRun(Integer recurrMaxRun) {
		this.recurrMaxRun = recurrMaxRun;
	}
    
	public Integer getRecurrRunCnt() {
		return recurrRunCnt;
	}
    
	public void setRecurrRunCnt(Integer recurrRunCnt) {
		this.recurrRunCnt = recurrRunCnt;
	}
    
	public Timestamp getScheduleEnd() {
		return scheduleEnd;
	}
    
	public void setScheduleEnd(Timestamp scheduleEnd) {
		this.scheduleEnd = scheduleEnd;
	}
    
	public String getScheduleName() {
		return scheduleName;
	}
    
	public void setScheduleName(String scheduleName) {
		this.scheduleName = scheduleName;
	}
    
	public Timestamp getScheduleStart() {
		return scheduleStart;
	}
    
	public void setScheduleStart(Timestamp scheduleStart) {
		this.scheduleStart = scheduleStart;
	}
    
	public Integer getScheduleStyle() {
		return scheduleStyle;
	}
    
	public void setScheduleStyle(Integer scheduleStyle) {
		this.scheduleStyle = scheduleStyle;
	}
    
	public Integer getScheduleType() {
		return scheduleType;
	}
    
	public void setScheduleType(Integer scheduleType) {
		this.scheduleType = scheduleType;
	}
    
	public Integer getWorkflowRecordID() {
		return workflowRecordID;
	}
    
	public void setWorkflowRecordID(Integer workflowRecordID) {
		this.workflowRecordID = workflowRecordID;
	}
    
	public MaintWorkflowScheduleTriggerForm() {
		super();
	}
    
	public AbstractBaseObject getFormData() throws ApplicationException {
		WorkflowScheduleTriggers tmpWorkflowScheduleTriggers = new WorkflowScheduleTriggers();
    tmpWorkflowScheduleTriggers.setID(TextUtility.parseIntegerObj(this.getID()));
    tmpWorkflowScheduleTriggers.setWorkflowRecordID(this.getWorkflowRecordID());
    tmpWorkflowScheduleTriggers.setScheduleName(this.getScheduleName());
    tmpWorkflowScheduleTriggers.setCriteriaExpression(this.getCriteriaExpression());
    tmpWorkflowScheduleTriggers.setCriteriaConfig(this.getCriteriaConfig());
    tmpWorkflowScheduleTriggers.setScheduleStart(this.getScheduleStart());
    tmpWorkflowScheduleTriggers.setScheduleEnd(this.getScheduleEnd());
    tmpWorkflowScheduleTriggers.setScheduleType(this.getScheduleType());
    tmpWorkflowScheduleTriggers.setScheduleStyle(this.getScheduleStyle());
    tmpWorkflowScheduleTriggers.setIncludeList(this.getIncludeList());
    tmpWorkflowScheduleTriggers.setExtraParameter1(this.getExtraParameter1());
    tmpWorkflowScheduleTriggers.setExtraParameter2(this.getExtraParameter2());
    tmpWorkflowScheduleTriggers.setRecurrRunCnt(this.getRecurrRunCnt());
    tmpWorkflowScheduleTriggers.setRecurrMaxRun(this.getRecurrMaxRun());
    tmpWorkflowScheduleTriggers.setRecurrExpression(this.getRecurrExpression());
    tmpWorkflowScheduleTriggers.setStatus(this.getStatus());
    tmpWorkflowScheduleTriggers.setRecordStatus(this.getRecordStatus());
    tmpWorkflowScheduleTriggers.setUpdateCount(TextUtility.parseIntegerObj(this.getUpdateCount()));
    tmpWorkflowScheduleTriggers.setCreatorID(TextUtility.parseIntegerObj(this.getCreatorID()));
    tmpWorkflowScheduleTriggers.setCreateDate(parseTimestamp(this.getCreateDate()));
    tmpWorkflowScheduleTriggers.setUpdaterID(TextUtility.parseIntegerObj(this.getUpdaterID()));
    tmpWorkflowScheduleTriggers.setUpdateDate(parseTimestamp(this.getUpdateDate()));
    return tmpWorkflowScheduleTriggers;
	}
    
	public void setFormData(AbstractBaseObject baseObj)	throws ApplicationException {
		WorkflowScheduleTriggers tmpWorkflowScheduleTriggers = (WorkflowScheduleTriggers)baseObj;
    this.setID(TextUtility.formatIntegerObj(tmpWorkflowScheduleTriggers.getID()));
    this.setWorkflowRecordID(tmpWorkflowScheduleTriggers.getWorkflowRecordID());
    this.setScheduleName(tmpWorkflowScheduleTriggers.getScheduleName());
    this.setCriteriaExpression(tmpWorkflowScheduleTriggers.getCriteriaExpression());
    this.setCriteriaConfig(tmpWorkflowScheduleTriggers.getCriteriaConfig());
    this.setScheduleStart(tmpWorkflowScheduleTriggers.getScheduleStart());
    this.setScheduleEnd(tmpWorkflowScheduleTriggers.getScheduleEnd());
    this.setScheduleType(tmpWorkflowScheduleTriggers.getScheduleType());
    this.setScheduleStyle(tmpWorkflowScheduleTriggers.getScheduleStyle());
    this.setIncludeList(tmpWorkflowScheduleTriggers.getIncludeList());
    this.setExtraParameter1(tmpWorkflowScheduleTriggers.getExtraParameter1());
    this.setExtraParameter2(tmpWorkflowScheduleTriggers.getExtraParameter2());
    this.setRecurrRunCnt(tmpWorkflowScheduleTriggers.getRecurrRunCnt());
    this.setRecurrMaxRun(tmpWorkflowScheduleTriggers.getRecurrMaxRun());
    this.setRecurrExpression(tmpWorkflowScheduleTriggers.getRecurrExpression());
    this.setStatus(tmpWorkflowScheduleTriggers.getStatus());
    this.setRecordStatus(tmpWorkflowScheduleTriggers.getRecordStatus());
    this.setUpdateCount(TextUtility.formatIntegerObj(tmpWorkflowScheduleTriggers.getUpdateCount()));
    this.setCreatorID(TextUtility.formatIntegerObj(tmpWorkflowScheduleTriggers.getCreatorID()));
    this.setCreateDate(formatTimestamp(tmpWorkflowScheduleTriggers.getCreateDate()));
    this.setUpdaterID(TextUtility.formatIntegerObj(tmpWorkflowScheduleTriggers.getUpdaterID()));
    this.setUpdateDate(formatTimestamp(tmpWorkflowScheduleTriggers.getUpdateDate()));
	}
    
  public ActionErrors validate(ActionMapping mapping, HttpServletRequest request) {
    return super.validate(mapping, request);
  }  

	public String getWorkflowGroupID() {
		return workflowGroupID;
	}
    
	public void setWorkflowGroupID(String workflowGroupID) {
		this.workflowGroupID = workflowGroupID;
	}
    
  public String getDailyStyle() {
		return dailyStyle;
	}
  
	public void setDailyStyle(String dailyStyle) {
		this.dailyStyle = dailyStyle;
	}
  
	public String getDayOfMonth() {
		return dayOfMonth;
	}
    
	public void setDayOfMonth(String dayOfMonth) {
		this.dayOfMonth = dayOfMonth;
	}

	public String getDayOfWeek() {
		return dayOfWeek;
	}
    
	public void setDayOfWeek(String dayOfWeek) {
		this.dayOfWeek = dayOfWeek;
	}
    
	public String[] getDaysOfWeek() {
		return daysOfWeek;
	}
    
	public void setDaysOfWeek(String[] daysOfWeek) {
		this.daysOfWeek = daysOfWeek;
	}
    
	public String getEndDate() {
		return endDate;
	}
    
	public void setEndDate(String endDate) {
		this.endDate = endDate;
	}
    
	public String getEndStyle() {
		return endStyle;
	}
    
	public void setEndStyle(String endStyle) {
		this.endStyle = endStyle;
	}
    
	public String getMaxTrigger() {
		return maxTrigger;
	}
    
	public void setMaxTrigger(String maxTrigger) {
		this.maxTrigger = maxTrigger;
	}
    
	public String getMonthlyStyle() {
		return monthlyStyle;
	}
    
	public void setMonthlyStyle(String monthlyStyle) {
		this.monthlyStyle = monthlyStyle;
	}
    
	public String[] getMonthsOfYear() {
		return monthsOfYear;
	}
    
	public void setMonthsOfYear(String[] monthsOfYear) {
		this.monthsOfYear = monthsOfYear;
	}
    
	public String getStartDate() {
		return startDate;
	}
    
	public void setStartDate(String startDate) {
		this.startDate = startDate;
	}
    
	public int getTriggerHour() {
		return triggerHour;
	}
    
	public void setTriggerHour(int triggerHour) {
		this.triggerHour = triggerHour;
	}
    
	public int getTriggerMinute() {
		return triggerMinute;
	}
    
	public void setTriggerMinute(int triggerMinute) {
		this.triggerMinute = triggerMinute;
	}
    
	public String getWeeklyStyle() {
		return weeklyStyle;
	}
    
	public void setWeeklyStyle(String weeklyStyle) {
		this.weeklyStyle = weeklyStyle;
	}
    
	public String getWeekOfMonth() {
		return weekOfMonth;
	}
    
	public void setWeekOfMonth(String weekOfMonth) {
		this.weekOfMonth = weekOfMonth;
	}
    
	public String getIntervalDay() {
		return intervalDay;
	}
    
	public void setIntervalDay(String intervalDay) {
		this.intervalDay = intervalDay;
	}    

	public String getIntervalWeek() {
		return intervalWeek;
	}
    
	public void setIntervalWeek(String intervalWeek) {
		this.intervalWeek = intervalWeek;
	}

	public void reset(ActionMapping mapping, HttpServletRequest request){
		super.reset(mapping, request);
		 this.setID(null);
	    this.setWorkflowRecordID(null);
	    this.setScheduleName(null);
	    this.setCriteriaExpression(null);
	    this.setCriteriaConfig(null);
	    this.setScheduleStart(null);
	    this.setScheduleEnd(null);
	    this.setScheduleType(null);
	    this.setScheduleStyle(null);
	    this.setIncludeList(null);
	    this.setExtraParameter1(null);
	    this.setExtraParameter2(null);
	    this.setRecurrRunCnt(null);
	    this.setRecurrMaxRun(null);
	    this.setRecurrExpression(null);
	    this.setStatus(null);
	    this.setRecordStatus(null);
	    this.setUpdateCount(null);
	    this.setCreatorID(null);
	    this.setCreateDate(null);
	    this.setUpdaterID(null);
	    this.setUpdateDate(null);
	    this.setTriggerHour(-1);
	    this.setTriggerMinute(-1);
	    this.setDailyStyle(null);
	    this.setWeeklyStyle(null);
	    this.setMonthlyStyle(null);
	    this.setEndStyle(null);
	    this.setDaysOfWeek(null);
	    this.setDayOfMonth(null);
	    this.setDayOfWeek(null);
	    this.setWeekOfMonth(null);
	    this.setMonthsOfYear(null);
	    this.setStartDate(null);
	    this.setEndDate(null);
	    this.setMaxTrigger(null);
	    this.setIntervalDay(null);
	    this.setIntervalWeek(null);
	}
}
